﻿@{
    Layout = null;
    var moduleSEModel = ViewBag.moduleSEModel as NB.MGJ.Model.Origins_ModuleSE;
    var materialModel = ViewBag.materialModel as NB.MGJ.Model.Origins_Material;
    var exDic = ViewBag.exDic as Dictionary<string, string>;

    var flowList = ViewBag.flowList as List<NB.MGJ.Model.OriginsEntity.FlowSEModel>;
}
@*黄金版*@

<link href="~/Content/TraceSource/main.css" rel="stylesheet" />
<link href="~/Content/TraceSource/ExperienceCenter.css" rel="stylesheet" />
<link href="~/Content/TraceSource/S_Gpublic.css" rel="stylesheet" />

<style>
    .phone-con-bar img
    {
        width: 100%;
        height: auto !important;
    }

    .p-size
    {
        width: 100% !important;
        height: auto !important;
    }

    .nb-remove-css
    {
        background: #FFFFFF !important;
        margin-left: 0 !important;
    }

    .static-trace-box
    {
        background: white;
        min-height: 356px !important;
        max-height: 450px;
        height: auto;
    }
</style>



<!--右侧浮动-->
<div id="fixed_right">
    <div class="glyphicon glyphicon-chevron-left m-r-xs fixed_right_hover fixed_right_icon" style="display:none"></div>
    <div>
        <div class="glyphicon glyphicon-chevron-right m-r-xs fixed_right_hover fixed_right_icon"></div>
        <div class="fixed_right fixed_right_hover" id="scyl" name="scyl" onclick="$.MGJ.Common._PrewView(@materialModel.MaterialId, 0);">预览</div>
        <div class="fixed_right fixed_right_hover" onclick="UrlBack()">返回</div>
    </div>
</div>

<div class="wrapper wrapper-content fadeInRight m-pagecontent">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <ul class="phone-ul clearfix">
                        <li class="col-lg-6 phone-model m-pageleft">
                            <div>
                                <div class="model-bar model-m">
                                    <div class="phone-bar phone-bar-m ">
                                        <h3 class="phone-title">
                                            <span class="iconfont icon-jiantou1 back-icon">
                                            </span> 产品详情
                                        </h3>
                                        <div class="phone-con-bar phone-con-bar-m">
                                            @if (moduleSEModel.Picture == "")
                                            {
                                                <img src="~/Content/webImgs/TraceSource/TraceSourceEdit/product-logo-default.png" class="phone-pro-pic show-img p-size" />
                                                <img src="~/Content/CommonCss/layer/skin/default/icon-ext.png" class="phone-pro-pic show-img p-size" />
                                            }
                                            else
                                            {
                                                <img src="@moduleSEModel.Picture" class="phone-pro-pic show-img p-size" />
                                            }

                                            <div class="phone-pro-name-bar">
                                                <h3 class="phone-pro-name" style="display:inline-block;">产品名称：</h3>
                                                <h3 class="phone-pro-name" id="phone-product-name" style="display:inline-block;">@moduleSEModel.ProductName</h3>
                                            </div>
                                            <div class="format-bar">
                                                规格参数
                                            </div>
                                            <ul class="format-ul clearfix">
                                                <li>
                                                    <span class="format-name">产品编号：</span>
                                                    <span class="format-con" id="phone-product-bar">@moduleSEModel.ProductCode</span>
                                                </li>
                                                <li>
                                                    <span class="format-name">产地：</span>
                                                    <span class="format-con" id="phone-product-place">@moduleSEModel.ProduceArea</span>
                                                </li>
                                                <li>
                                                    <span class="format-name">规格：</span>
                                                    <span class="format-con" id="phone-product-format">@moduleSEModel.Format</span>
                                                </li>

                                                @if (exDic != null && exDic.Count > 0)
                                                {
                                                    foreach (KeyValuePair<string, string> item in exDic)
                                                    {
                                                        <li class="mobile-hidden-li mobile-show-li">
                                                            <span class="format-name">@item.Key：</span>
                                                            <span class="format-con">@item.Value</span>
                                                        </li>
                                                    }
                                                }


                                            </ul>
                                            <ul class="mobile-trace" id="phone_show_id">
                                                <li class="trace-icon"></li>


                                                @if (flowList.Count == 0)
                                                {
                                                    <li class="mobile-trace-list clearfix">
                                                        <p class="trace-step pull-left">第<span class="static-num">1</span>步</p>
                                                        <div class="left-trace-info pull-left">
                                                            <div class="big-bg"></div>
                                                            <p class="trace-content-title">@*@flowList[0].title*@</p>
                                                            <img class="hidden" src="/static/img/trace/trace-img0.png" alt="img" height="132" />
                                                        </div>
                                                    </li>
                                                }
                                                @if (flowList.Count > 0)
                                                {
                                                    for (var i = 0; i < flowList.Count; i++)
                                                    {
                                                        if (i == 0)
                                                        {
                                                            var t = i + 1;
                                                            <li class="mobile-trace-list clearfix">
                                                                <p class="trace-step pull-left">第<span class="static-num">@t</span>步</p>
                                                                <div class="left-trace-info pull-left">
                                                                    <div class="big-bg"></div>
                                                                    <p class="trace-content-title">@flowList[i].title</p>
                                                                    <img @*class="hidden"*@ src="@flowList[i].img" alt="img" height="132" />
                                                                </div>
                                                            </li>
                                                        }
                                                        else
                                                        {
                                                            var t = i + 1;
                                                            <li class="mobile-trace-list clearfix">
                                                                <p class="trace-step pull-left">第<span class="static-num">@t</span>步</p>
                                                                <div class="left-trace-info pull-left">
                                                                    <div class="big-bg"></div>
                                                                    <p class="trace-content-title">@flowList[i].title</p>
                                                                    <img @*class="hidden"*@ src="@flowList[i].img" alt="img" height="132" />
                                                                </div>
                                                            </li>

                                                        }
                                                    }
                                                }

                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li class="col-lg-6 m-pageright">
                            <form class="error-tips-bottom create-product" id="create-form" method="POST" novalidate="novalidate">
                                <ul class="create-ul create-w">
                                    <li>
                                        <p class="input-title create-ul-h5">
                                            产品名称
                                            <span class="red-color">*</span>
                                        </p>
                                        <input value="@moduleSEModel.ProductName" type="text" placeholder="请输入不超过30个字的产品名称" class="form-control input-lg input-in create-inp create-inp-num" maxlength="30" id="product-name" name="name"><span class="inp-num" id="product-name-num">0/30</span>
                                    </li>
                                    <li>
                                        <p class="input-title create-ul-h5">
                                            产品编号<span class="red-color">*</span>
                                        </p>
                                        <input value="@moduleSEModel.ProductCode" type="text" placeholder="请输入不超过13位的产品编号" class="form-control input-lg input-in create-inp create-inp-num" maxlength="13" id="product-bar" name="bar_code">
                                        <span class="inp-num" id="product-bar-num">0/13</span>
                                    </li>
                                    <li>
                                        <p class="input-title create-ul-h5">
                                            产地
                                            <span class="red-color">*</span>
                                        </p>
                                        <input value="@moduleSEModel.ProduceArea" type="text" placeholder="请输入产品的生产地址" class="form-control input-lg input-in create-inp" id="product-place" name="address">
                                    </li>
                                    <li>
                                        <p class="input-title create-ul-h5">
                                            规格<span class="red-color">*</span>
                                        </p>
                                        <input value="@moduleSEModel.Format" type="text" placeholder="请输入产品的规格" class="form-control input-lg input-in create-inp" id="product-format" name="specification">
                                    </li>
                                    <li>
                                        <div class="upload-product-box">
                                            <p class="clearfix input-title input-title-img form-label-title">
                                                <span class="pull-left">图片<span class="red-text">*</span></span>
                                            </p>
                                            <div class="imageBox verify-show file-inp-bar">
                                                <div class="thumbBox">
                                                </div>
                                                <div class="spinner" style="">
                                                    Loading...
                                                </div>
                                            </div>
                                            <div class="note">
                                                （请选择大小不超过2M的图片）
                                            </div>
                                            <div class="action upload-file-img clearfix">
                                                <div class="new-contentarea file-inp-bar tc">
                                                    <a href="javascript:void(0)" class="upload-img  nb-btn-css"><label for="upload-file">上传图片</label></a><input type="file" class="upload-file-cropper" name="upload_file" id="upload-file">
                                                </div>
                                                <input type="button" id="btnZoomIn" class="Btnsty_peyton pull-left  nb-btn-css" value="+"><input type="button" id="btnZoomOut" class="Btnsty_peyton pull-left  nb-btn-css" value="-"><input type="button" id="btnCrop" class="Btnsty_peyton special-width pull-right  nb-btn-css" value="确定裁切">
                                            </div>
                                        </div>
                                    </li>
                                    @if (exDic != null && exDic.Count > 0)
                                    {

                                        foreach (KeyValuePair<string, string> item in exDic)
                                        {
                                            <li class="newadd-li">
                                                <div class="input-group create-w">
                                                    <input value="@item.Key" type="text" class="form-control newadd valid" name="more_title" maxlength="10" placeholder="添加标题">
                                                    <span class="input-group-btn"><button style="background-color:#FFFFFF" type="button" class="btn btn-outline btn-danger newadd-remove nb-remove-css">删除</button></span>
                                                </div>
                                                <input value="@item.Value" type="text" placeholder="请输入想添加的内容" maxlength="30" name="more_con" class="form-control input-lg newadd-con valid">
                                            </li>
                                        }
                                    }

                                    <button type="button" style="border-radius:3px" class="btn btn-block btn-outline btn-success newadd-button">＋添加其他信息</button>
                                    <div id="FlowWrap">
                                        <ul class="create-ul create-w">
                                            <li>
                                                <div class="tips-title clearfix inp-bar prizes">
                                                    <p class="clearfix input-title form-label-title">
                                                        <span class="pull-left">
                                                            增加溯源信息<span class="red-text">*</span>
                                                            &nbsp;&nbsp;&nbsp;
                                                        </span>
                                                    </p> <ul class="static-trace-box">
                                                        <li class="static-list-title">商品追溯</li>

                                                        @if (flowList.Count == 0)
                                                        {
                                                            <li class="static-list first clearfix">
                                                                <p class="static-step pull-left">第<span class="static-num">1</span>步</p>
                                                                <div class="right-trace-msg pull-left">
                                                                    <div class="big-bg"></div>
                                                                    <textarea name="trace_title" class="trace-title pull-left" placeholder="请输入溯源信息"></textarea>
                                                                    <div class="trace-img pull-left">
                                                                        <label class="button-upload-img" for="upload-img"></label>
                                                                        <input type="file" id="upload-img" class="file-input" value="">
                                                                    </div>
                                                                </div> <div class="handle-box">
                                                                           <span class="glyphicon glyphicon-remove icon-shanchu hidden"></span>
                                                                           <span class="add-btn glyphicon glyphicon-plus hidden">
                                                                           </span>
                                                                </div>
                                                            </li>
                                                        }
                                                        @if (flowList.Count > 0)
                                                        {
                                                            for (var i = 0; i < flowList.Count; i++)
                                                            {
                                                                if (i == 0)
                                                                {
                                                                    var t = i + 1;
                                                                    var ustring = "upload-img2" + t;
                                                                    <li class="static-list first clearfix">
                                                                        <p class="static-step pull-left">第<span class="static-num">1</span>步</p>
                                                                        <div class="right-trace-msg pull-left">
                                                                            <div class="big-bg"></div>
                                                                            <textarea name="trace_title" class="trace-title pull-left" placeholder="请输入溯源信息">@flowList[i].title</textarea>
                                                                            <div class="trace-img pull-left">
                                                                                @if (string.IsNullOrEmpty(flowList[i].img))
                                                                                {
                                                                                    <label class="button-upload-img" for="upload-img"></label>
                                                                                }
                                                                                else
                                                                                {
                                                                                    <label class="button-upload-img" for="upload-img" style="background-image:url(@flowList[i].img)"></label>
                                                                                }

                                                                                <input type="file" id="upload-img" class="file-input" value="">
                                                                                <input type="hidden" name="filename" value="@flowList[i].img">
                                                                            </div>
                                                                        </div>
                                                                        <div class="handle-box">
                                                                            <span class="delete-btn glyphicon glyphicon-remove hidden"></span>
                                                                            <span class="add-btn glyphicon glyphicon-plus hidden"></span>
                                                                        </div>
                                                                    </li>
                                                                }
                                                                else
                                                                {
                                                                    var t = i + 1;
                                                                    var ustring = "upload-img2" + t;
                                                                    <li class="static-list clearfix">
                                                                        <p class="static-step pull-left">第<span class="static-num">@t</span>步</p>
                                                                        <div class="right-trace-msg pull-left">
                                                                            <div class="big-bg"></div>
                                                                            <textarea name="trace_title" class="trace-title pull-left" placeholder="请输入溯源信息">@flowList[i].title</textarea>
                                                                            <div class="trace-img pull-left">
                                                                                <label class="button-upload-img" for="@ustring" style="background-image:url(@flowList[i].img)"></label>
                                                                                <input type="file" id="@ustring" class="file-input">
                                                                                <input type="hidden" name="filename" value="@flowList[i].img">
                                                                            </div>
                                                                        </div>
                                                                        <div class="handle-box">
                                                                            <span class="delete-btn glyphicon glyphicon-remove hidden"></span>
                                                                            <span class="add-btn glyphicon glyphicon-plus hidden"></span>
                                                                        </div>
                                                                    </li>
                                                                }
                                                            }
                                                        }
                                                    </ul>
                                                </div>
                                            </li>
                                        </ul>
                                    </div>
                                    <button id="save" type="submit" class="btn btn-block btn-success  nb-btn-border nb-btn-margin-tb" onclick="imgFormCheck()">保存</button>
                                </ul>
                            </form>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>
<li class="hidden newadd-li">
    <div class="input-group create-w">
        <input type="text" class="form-control newadd" name="more_title" maxlength="10" placeholder="添加标题">
        <span class="input-group-btn"><button type="button" class="btn btn-outline btn-danger newadd-remove nb-remove-css">删除</button></span>
    </div>
    <input type="text" placeholder="请输入想添加的内容" maxlength="30" name="more_con" class="form-control input-lg newadd-con">
</li>
<li class="hidden mobile-hidden-li">
    <span class="format-name"></span>
    <span class="format-con"></span>
</li>
@*<img src="/upload/20170721092925-blob.jpeg">
    <img src="/upload/20170721092044-blob.jpeg">*@

@*<script src="~/Content/Scripts/jquery.min.js"></script>
<script src="~/Content/Scripts/jquery.qrcode.min.js"></script>
<script src="~/Content/Scripts/pages/jquery.validate.min.js"></script>
<script src="~/Content/Scripts/Area/Origins/Material/cropbox.js"></script>
<script src="~/Content/Scripts/Area/Origins/Material/sec1.js"></script>
<script src="~/Content/Scripts/Area/Origins/Material/html5ImgCompress.js"></script>
<script src="~/Content/Scripts/Area/Origins/Material/2.chunk.min.js"></script>*@

<script src="~/Scripts/MGJJS/TraceSource/PageOperation/jquery.qrcode.min.js"></script>
<script src="~/Scripts/MGJJS/TraceSource/PageOperation/jquery.validate.min.js"></script>
<script src="~/Scripts/MGJJS/TraceSource/PageOperation/cropbox.js"></script>
<script src="~/Scripts/MGJJS/TraceSource/PageOperation/sec1.js"></script>
<script src="~/Scripts/MGJJS/TraceSource/PageOperation/html5ImgCompress.js"></script>
<script src="~/Scripts/MGJJS/TraceSource/PageOperation/2.chunk.min.js"></script>

<script>

    $(function () {
        function e(flow) {
            var e = {}, n = new FormData, a = $(".newadd"), t = $(".newadd-con");
            for (var i = 0; i < a.length; i++) {
                a[i].value && t[i].value && (e[a[i].value] = t[i].value);
            };
            n.append("Flow", JSON.stringify(flow))
            n.append("ModuleId", '@moduleSEModel.ModuleId')
            n.append("ProductName", $("#product-name").val()),
            n.append("ProductCode", $("#product-bar").val()),
            n.append("ProduceArea", $("#product-place").val()),
            n.append("Format", $("#product-format").val()),
            n.append("ExtendInfo", JSON.stringify(e))
            n.append("Picture", cropper.getBlob(), "blob.png"),
    //console.log(cropper.getBlob()),
    $.ajax({
        url: "/OriginsMaterial/ModuleSESave",
        type: "POST",
        async: false,
        timeout: 5e3,
        crossDomain: true,
        xhrFields: {
            withCredentials: true
        },
        processData: false,
        contentType: false,
        data: n,
        context: $("#create-form"),
        success: function (e) {
            $.L.msgSuccess("保存成功")
        },
        error: function (jqXHR, textStatus, errorThrown) {
            $.L.msgError(jqXHR.responseText);
        }
    })
        };

        //input 产品名称产品编号 长度控制
        $(".create-inp").keyup(function (e) {
            $("#phone-product-name").html($("#product-name").val());
            var n = $("#product-name").val().length;
            $("#product-name-num").html(n + "/30"), $("#phone-product-bar").html($("#product-bar").val());
            var a = $("#product-bar").val().length;
            //$("#product-bar-num").html(a + "/13"), $("#phone-product-place").html($("#product-place").val()), $("#phone-product-format").html($("#product-format").val()), "" == $("#product-name").val() && $("#phone-product-name").html("产品名称")
            $("#product-bar-num").html(a + "/13"), $("#phone-product-place").html($("#product-place").val()), $("#phone-product-format").html($("#product-format").val()), "" == $("#product-name").val()
        })

        deal_cropper(),//图片裁剪
        $("div.upload-product-box").get(0).addEventListener("mousewheel", removeWheelEvent, !1),
        $(".newadd-button").click(function () {

            var e = $(".newadd-li.hidden").clone();
            e.removeClass("hidden"), $(this).before(e), new_more_info()
        }),
        $("body").on("click", ".newadd-remove", function () {
            isIE() ? $(this).parents("li")[0].removeNode(!0) : $(this).parents("li")[0].remove(), change_more_info()
        }),
        $("body").on("change", ".newadd", function () {
            change_more_info()
        }),
        $("body").on("change", ".newadd-con", function () {
            change_more_info()
        })
        $("#create-form").validate({
            ignore: "",
            rules: {
                brand_id: {
                    required: true
                },
                name: {
                    required: true,
                    maxlength: 30
                },
                bar_code: {
                    required: true,
                    maxlength: 13
                },
                address: {
                    required: true,
                    maxlength: 30
                },
                specification: {
                    required: true,
                    maxlength: 20
                },
                //upload_file: {
                //    required: !0,
                //    checkSize: 2
                //}
            },
            messages: {
                brand_id: {
                    required: "请选择批次"
                },
                name: {
                    required: "请输入不超过30个字的产品名称",
                    maxlength: "请输入不超过30个字的产品名称"
                },
                bar_code: {
                    required: "请输入不超过13位的产品编号",
                    maxlength: "请输入不超过13位的产品编号"
                },
                address: {
                    required: "请输入不超过30个字的产品生产地址",
                    maxlength: "请输入不超过30个字的产品生产地址"
                },
                specification: {
                    required: "请输入不超过20个字的产品的规格",
                    maxlength: "请输入不超过20个字的产品的规格"
                },
                //upload_file: {
                //    required: "请上传大小不超过2M的图片",
                //    checkSize: "请上传大小不超过2M的图片"
                //}
            },
            errorPlacement: jquery_valid_errorPlacement,
            success: jquery_valid_success,
            highlight: jquery_valid_highlight,
            onfocusout: jquery_valid_onfocusout,
            invalidHandler: jquery_valid_invalidHandler,
            onkeyup: !1,
            focusInvalid: !0,
            errorElement: "span",
            submitHandler: function (n) {


                var flow = [];
                $(n).find(":input[name=trace_title]").each(function () {
                    return $(this).val() ? void flow.push({
                        title: $(this).val(),
                        img: $(this).siblings(".trace-img").find("input[name=filename]").val() || ""
                    }) : ($(this).css("borderColor", "#f25c5a"), $("#trace-title-error").removeClass("hidden"), flow = [], !1)
                })

                if (flow.length == 0) {

                    (tipsBombObj = {
                        tipsKinds: "提示",
                        tipsText: "请检查信息填写是否完整？",
                        btnLeftUrl: "javascript:;",
                        btnLeftFunction: closeDialog,
                        btnLeftText: "取消",
                        btnRightUrl: "",
                        btnRightFunction: "",
                        btnRightText: "",
                        btnState: "hidden",
                        closePageText: 3,
                        redirectUrl: ""
                    },
              tipsBombSmall(tipsBombObj));
                } else {

                    e(flow);
                }
            }
        })
    });

    jQuery.validator.addMethod("numberAndLettersVal", function (value, element) {
        return this.optional(element) || /^[a-zA-Z0-9]+$/.test(value);
    }, $.validator.format("请输入13位以内的字母或数字")
    );

    //阻止事件冒泡
    function removeWheelEvent(e) {
        return e.stopPropagation(), e.preventDefault(), e.cancelBubble = !1, !1
    }

    function change_more_info() {

        $(".mobile-show-li").remove();
        for (var e = $(".newadd"), n = $(".newadd-con"), a = 0; a < e.length; a++) if (e[a].value || n[a].value) {
            var t = $(".mobile-hidden-li.hidden").clone();
            t.removeClass("hidden"), t.addClass("mobile-show-li"), t.find("span.format-name").text(e[a].value + "："), t.find("span.format-con").text(n[a].value), $(".format-ul").append(t)
        }
    }
    function new_more_info() {
        var e = $(".mobile-hidden-li.hidden").clone();
        e.removeClass("hidden"), e.addClass("mobile-show-li"), e.find("span.format-name").text("新增："), e.find("span.format-con").text(""), $(".format-ul").append(e)
    }

</script>

<script>

    $(function () {

        $("body").delegate(".file-input", "change", function (e) {
            new html5ImgCompress(

            e.target.files[0], {
                quality: .9,

                before: function (e) {
                    if (e.type.indexOf("image") == -1) return !1
                },
                done: function (t, a) {
                    function i(t) {
                        var a = t;
                        $(e.target).siblings("input[name=filename]").length >= 1 ? $(e.target).siblings("input[name=filename]").val(a) : $(e.target).after('<input type="hidden" name="filename" value="' + a + '" />')
                    }
                    $(e.target).siblings("label").css("backgroundImage", "url(" + a + ")");
                    var n = $(e.target).parent().parent().parent().index("li.static-list");
                    $(".mobile-trace-list").eq(n).find("img").removeClass("hidden").attr("src", a)
                    , uploadFile(a, i, "1", !0)
                },
                fail: function (t) {
                    $(e.target).siblings("label").css("backgroundImage", "url(" + t + ")");
                    var a = $(e.target).parent().parent().parent().index("li.static-list");
                    $(".mobile-trace-list").eq(a).find("img").removeClass("hidden").attr("src", t)
                },
                complete: function (e) { },
                notSupport: function (t) {
                    $(e.target).siblings("label").css("backgroundImage", "url(" + t + ")");
                    var a = $(e.target).parent().parent().parent().index("li.static-list");
                    $(".mobile-trace-list").eq(a).find("img").removeClass("hidden").attr("src", t)
                }
            })
        })
        , $("body").delegate("li.static-list:last", "mouseover", function () {
            $(this).find(".delete-btn").removeClass("hidden"), $(this).find(".add-btn").removeClass("hidden")
        }).delegate("li.static-list", "mouseout", function () {
            $(this).find(".delete-btn").addClass("hidden"), $(this).find(".add-btn").addClass("hidden")
        })
        , $("body").delegate("li.static-list:first", "mouseover", function () {
            $(this).find(".delete-btn").addClass("hidden")
        }), $("body").delegate(".add-btn", "click", function () {
            var e = $(this).parent().parent().index("li.static-list"),
                t = e + 2;
            $('<li class="static-list clearfix">            <p class="static-step pull-left">第<span class="static-num">' + t + '</span>步</p>            <div class="right-trace-msg pull-left">              <div class="big-bg"></div>              <textarea name="trace_title" class="trace-title pull-left" placeholder="请输入溯源信息"></textarea>              <div class="trace-img pull-left">                <label class="button-upload-img" for="upload-img' + t + '"></label>                <input type="file" id="upload-img' + t + '" class="file-input">              </div>            </div>            <div class="handle-box">              <span class="delete-btn glyphicon glyphicon-remove hidden"></span>              <span class="add-btn glyphicon glyphicon-plus hidden"></span>            </div>      </li>').appendTo($(".static-trace-box")), $('<li class="mobile-trace-list clearfix">           <p class="trace-step pull-left">第<span class="static-num">' + t + '</span>步</p>           <div class="left-trace-info pull-left">              <div class="big-bg"></div>              <p class="trace-content-title">请输入溯源信息</p>              <img class="hidden" src="/static/img/trace/trace-img0.png" alt="img" height="132">           </div>         </li>').appendTo($(".mobile-trace")), $(this).addClass("hidden"), $(this).siblings(".delete-btn").addClass("hidden")
        })
        , $("body").delegate(".delete-btn", "click", function () {
            var e = $(this).parent().parent().index("li.static-list");
            $(this).parent().parent().remove(), $(".mobile-trace-list").eq(e).remove()
        })
        , $("body").delegate("textarea.trace-title", "keyup", function () {
            var e = $(this).parent().parent().index("li.static-list"),
                t = $(".mobile-trace-list").eq(e);
            t.find(".trace-content-title").text($(this).val())
        })
        , $("body").delegate("textarea.trace-title", "focusin", function () {
            $(this).css("borderColor", "#e7e7e7"), $("#trace-title-error").addClass("hidden")
        })
        , $("input[name=name]").keyup(function () {
            var e = $(this).val().length;
            $("#product-bar-num").html(e + "/30")
        })
    })


</script>
